package com.ljh.jxc.modules.suo.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ljh.jxc.modules.suo.entity.Godownentry;
import com.ljh.jxc.modules.suo.service.GodownentryService;
import com.ljh.jxc.common.utils.PageUtils;
import com.ljh.jxc.common.utils.R;



/**
 * 入库单
 *
 * @author liujinghui
 * @email liujinghui@163.com
 * @date 2021-12-01 13:57:23
 */
@RestController
@RequestMapping("jxc/godownentry")
public class GodownentryController {
    @Autowired
    private GodownentryService godownentryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxc:godownentry:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = godownentryService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{godownentryId}")
    @RequiresPermissions("jxc:godownentry:info")
    public R info(@PathVariable("godownentryId") String godownentryId){
		Godownentry godownentry = godownentryService.getById(godownentryId);

        return R.ok().put("godownentry", godownentry);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxc:godownentry:save")
    public R save(@RequestBody Godownentry godownentry){
		godownentryService.save(godownentry);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxc:godownentry:update")
    public R update(@RequestBody Godownentry godownentry){
		godownentryService.updateById(godownentry);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxc:godownentry:delete")
    public R delete(@RequestBody String[] godownentryIds){
		godownentryService.removeByIds(Arrays.asList(godownentryIds));

        return R.ok();
    }

}
